﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>BaseControl</title>
<style type="text/css">
.auto-style1 {
	color: #000064;
}
</style>
</head>

<body>
<h1>jSLCore.Client.Presentation.BaseControl.<span class="auto-style1">BaseControl</span></h1>
<p>jSLCore can hosts user forms (pages) of type BaseControl. If you want to show any form to user, inherit it from BaseControl type (additionally you can choose from DataControl, DialogControl and SelectControl)
This form inherits exactly BaseControl</p>
<h2>Important members</h2>

<ul>
	<li><span class="auto-style1">Title</span> - you can use it to keep title of the form</li>
	<li><span class="auto-style1">Icon</span> - icon of the form. Note, that jSLCore will not automatically show 
	Title and Icon (only for dialogs in dialog mode). If you want to show it - 
	you have to implement this logic in ContentContainerBase by overriding 
	<span class="auto-style1">ShowPage</span> method</li>
	<li><span class="auto-style1">NavigateTo</span> - close this form and show new one</li>
	<li>Validate - Validates bindings of the form</li>
	<li><span class="auto-style1">Bind</span> - Call it after setting data context, so bindings will bind 
	controls to their data context</li>
	<li>CustomError - Set this property to something to indicate, that the form 
	has error</li>
	<li>IsValid, HasErrors,GetFirstError,FirstErrorChanged</li>
	<li><span class="auto-style1">GetControlForInitialFocus</span> - override this method and return the control, 
	where to place focus after loading</li>
</ul>

<h2>Example</h2>
<ol>
	<li>Create new UserControl.</li>
	<li>Replace base class with BaseControl.</li>
	<li>Place any controls in it.</li>
	<li>Show it by returning new instance of it in overriding GetDefaultPage 
	method of the ContentContainerBase.</li>
	<li>Or navigate to from another control by using NavigateTo method.</li>
</ol>
<blockquote><code><font size="2" face="Consolas, Courier New, Courier, Monospace" color="black"><small><a href="http://s-c.me/25850/s">Copy&nbsp;Source</a>&nbsp;|&nbsp;<a href="http://s-c.me/25850/h">Copy&nbsp;HTML</a></small><ol><li><font color="#0000ff">&lt;</font><font color="#800000">BaseControl:BaseControl</font> <font color="#ff0000">x:Class</font><font color="#0000ff">="jSLApp.Client.Forms.ExampleControl"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">xmlns</font><font color="#0000ff">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">xmlns:x</font><font color="#0000ff">="http://schemas.microsoft.com/winfx/2006/xaml"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">xmlns:d</font><font color="#0000ff">="http://schemas.microsoft.com/expression/blend/2008"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">xmlns:mc</font><font color="#0000ff">="http://schemas.openxmlformats.org/markup-compatibility/2006"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">xmlns:BaseControl</font><font color="#0000ff">="clr-namespace:jSLCore.Client.Presentation.BaseControl;assembly=jSLCore.Client.Presentation"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">mc:Ignorable</font><font color="#0000ff">="d"</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff0000">d:DesignHeight</font><font color="#0000ff">="300"</font> <font color="#ff0000">d:DesignWidth</font><font color="#0000ff">="400"&gt;</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">&lt;</font><font color="#800000">TextBlock</font> <font color="#ff0000">Text</font><font color="#0000ff">="Hello world!"/&gt;</font></li>
<li><font color="#0000ff">&lt;/</font><font color="#800000">BaseControl:BaseControl</font><font color="#0000ff">&gt;</font></li>

</ol></font></code></blockquote>
<br/>
<blockquote><code><font size="2" face="Consolas, Courier New, Courier, Monospace" color="black"><small><a href="http://s-c.me/25851/s">Copy&nbsp;Source</a>&nbsp;|&nbsp;<a href="http://s-c.me/25851/h">Copy&nbsp;HTML</a></small><ol><li><font color="#0000ff">namespace</font> jSLApp.Client.Forms</li>
<li>{</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">public partial class</font> <font color="#2b91af">ExampleControl</font></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;{</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">public</font> <font color="#2b91af">ExampleControl</font>()</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InitializeComponent();</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;}</li>
<li>}</li>

</ol></font></code></blockquote>
<br/>
<blockquote><code><font size="2" face="Consolas, Courier New, Courier, Monospace" color="black"><small><a href="http://s-c.me/25849/s">Copy&nbsp;Source</a>&nbsp;|&nbsp;<a href="http://s-c.me/25849/h">Copy&nbsp;HTML</a></small><ol><li><font color="#0000ff">protected override</font> BaseControl GetDefaultPage()</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">return new</font> <font color="#2b91af">ExampleControl</font>();</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} </li>
</ol></font></code></blockquote>
<br/>
<blockquote><code><font size="2" face="Consolas, Courier New, Courier, Monospace" color="black"><small><a href="http://s-c.me/25852/s">Copy&nbsp;Source</a>&nbsp;|&nbsp;<a href="http://s-c.me/25852/h">Copy&nbsp;HTML</a></small><ol><li><font color="#0000ff">private void</font> goExampleForm_Clicked(<font color="#0000ff">object</font> sender, <font color="#2b91af">RoutedEventArgs</font> e)</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">var</font> form = <font color="#0000ff">new</font> <font color="#2b91af">ExampleControl</font>();</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NavigateTo(form);</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} </li>
</ol></font></code></blockquote>
</body>

</html>
